|
|
|
|
|
|
|
Listing A.42. Adding code to the Command1_Click event. |
|
|
|
|
|
|
|
|
Private Sub Command1_Click(Index As Integer)
'
Select Case Index
Case 0 ' start
objSQLVB5.Start
Case 1 ' run
objSQLVB5.Run
Case 2 ' about
objSQLVB5.About
Case 3 ' edit
objSQLVB5.Script = "c:\tysdbvb5\source\chapxa\scripts\sqltest.sqv"
objSQLVB5.Edit
Case 4 ' generate
objSQLVB5.DBName = "c:\tysdbvb5\source\data\books5.mdb"
objSQLVB5.Script = "c:\tysdbvb5\source\chapxa\scripts\books5.sqv"
objSQLVB5.Generate
End Select
'
End Sub |
|
|
|
|
|
|
|
|
Save and run the project. You can now test the various buttons and see how SQL-VB5 responds to your external application. |
|
|
|
|
|
|
|
|
You now have a very valuable tool to add to your database programming tool kit. You can use SQL-VB5 to generate database layouts for all your projects in the future. You can also use SQL-VB5 to test data integrity options, load test data into existing tables, and even create simple data backup and replication scripts. |
|
|
|
|
|
|
|
|
You could even add more options to the project. Here are some additional features that you might want to consider: |
|
|
|
|
|
|
|
|
· Add the ability to create non-Microsoft Jet database files such as dBASE, FoxPro, and Paradox. To do this, you need to add additional parameters to the dbMake script line along with corresponding code in the SQLdbMake routine to handle the added information. |
|
|
|
|
|
|
|
|
· Add the ability to edit data within the grids that appear in the main form. You need to review the DBGrid control and set some additional parameters before you launch the SQLVBChild form. |
|
|
|
|
|
|
|
|
· Make SQL-VB5 an Add-In application. This involves adding a class module to the project and declaring an SQL-VB5 class with at least one method that loads and processes a script. Check the Visual Basic documentation on creating OLE-enabled applications for more information on how to create a Visual Basic Add-In. |
|
|
|
|
|